<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script src="js/抽象工厂模式.js"></script>
<script>
    function Car(option) {
        // some defaults
        this.color = option.color || "sivler";
        this.state = option.state || 4;
    }
    Car.prototype.drive = "enging";
    Car.prototype.breakDown = "breakdown";
    // Usage:
    AbstractVehicleFactory.registerVehicle("car", Car);
    // Instantiate a new truck in a similar manner
    var car = AbstractVehicleFactory.getVehicle("car", {
        color: "lime green",
        state: "like new"
    });
    console.log(car);
</script>
</body>
</html>